<template>
  <div class="app-container customer-div">
    <el-tabs v-model="activeName" style="margin-top:20px;" type="card" @tab-click="tabClick">
      <el-tab-pane label="我的目标" name="my">
        <div style="margin-top: 20px">
          <!--搜索-->
          <el-form :inline="true" :model="listQuery" size="mini" label-width="80px">
            <el-form-item label="月份：">
              <el-date-picker
                value-format="yyyy-MM"
                v-model="listQuery.date"
                type="monthrange"
                range-separator="-"
                start-placeholder="开始月份"
                end-placeholder="结束月份">
              </el-date-picker>
            </el-form-item>
            <el-form-item>
              <el-button
                @click="handleSearchList()"
                type="primary">
                查询
              </el-button>
              <el-button
                @click="showPop('add','')"
                type="primary">
                新增目标
              </el-button>
            </el-form-item>
          </el-form>
        </div>
        <!--数据列表-->
        <el-table
          height="400"
          v-loading="listLoading"
          :data="tableData"
          border
          style="width: 100%; margin-top: 20px">
          <el-table-column
            label="销售员"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.userName}}
            </template>
          </el-table-column>
          <el-table-column
            label="司龄"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.time}}
            </template>
          </el-table-column>
          <el-table-column
            label="月份"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.month}}
            </template>
          </el-table-column>
          <el-table-column
            label="基准量"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.standard}}
            </template>
          </el-table-column>
          <el-table-column
            label="交接量"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.additional}}
            </template>
          </el-table-column>
          <el-table-column
            label="最低目标"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.minVolume}}
            </template>
          </el-table-column>
          <el-table-column
            label="月目标量"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.targetVolume}}
            </template>
          </el-table-column>
          <el-table-column
            label="实际业务量"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.volume}}
            </template>
          </el-table-column>
          <el-table-column
            label="目标完成率"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.finishedRate}}
            </template>
          </el-table-column>
          <el-table-column
            label="基本比例"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.percentAge}}
            </template>
          </el-table-column>
          <el-table-column
            label="目标系数"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.targetRate}}
            </template>
          </el-table-column>
          <el-table-column
            label="绩效提成比例"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.finishedRatio}}
            </template>
          </el-table-column>
          <el-table-column
            label="提成比例"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.royaltyRatio}}
            </template>
          </el-table-column>
          <el-table-column
            label="创建时间"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.createTime}}
            </template>
          </el-table-column>
          <el-table-column
            label="更新时间"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.updateTime}}
            </template>
          </el-table-column>
          <el-table-column
            fixed="right"
            label="操作"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              <el-button type="text" @click="showPop('edit',scope.row)">修改</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="pagination-container">
          <el-pagination
            background
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            layout="total, sizes,prev, pager, next,jumper"
            :current-page.sync="listQuery.pageNum"
            :page-size="listQuery.pageSize"
            :page-sizes="[10,15,20]"
            :total="count">
          </el-pagination>
        </div>

      </el-tab-pane>
      <el-tab-pane label="全部目标" name="all" v-if="monthTargetSaleAll"><!--v-if="monthTargetSaleAll"-->
          <div style="margin-top: 20px">
            <!--搜索-->
            <el-form :inline="true" :model="listQuery2" size="mini" label-width="80px">
              <el-form-item label="月份：">
                <el-date-picker
                  value-format="yyyy-MM"
                  v-model="listQuery2.date"
                  type="monthrange"
                  range-separator="-"
                  start-placeholder="开始月份"
                  end-placeholder="结束月份">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="业务员：">
                <el-select v-model="listQuery2.userIds" filterable placeholder="请选择" clearable multiple  style="width:440px;">
                  <el-option
                    v-for="item in userOptionList"
                    :key="item.userId"
                    :label="item.name"
                    :value="item.userId">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item>
                <el-button
                  @click="handleSearchList2()"
                  type="primary">
                  查询
                </el-button>
                <el-button
                  @click="showPop('add','')"
                  type="primary">
                  新增目标
                </el-button>
                <el-button
                  @click="showImport2"
                  type="primary">
                  批量导入目标
                </el-button>
              </el-form-item>
            </el-form>
          </div>
          <!--数据列表-->
          <el-table
            height="400"
            v-loading="listLoading2"
            :data="tableData2"
            border
            style="width: 100%; margin-top: 20px">
            <el-table-column
              label="销售员"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.userName}}
              </template>
            </el-table-column>
            <el-table-column
              label="司龄"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.time}}
              </template>
            </el-table-column>
            <el-table-column
              label="月份"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.month}}
              </template>
            </el-table-column>
            <el-table-column
              label="基准量"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.standard}}
              </template>
            </el-table-column>
            <el-table-column
              label="月目标量"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.targetVolume}}
              </template>
            </el-table-column>
            <el-table-column
              label="实际业务量"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.volume}}
              </template>
            </el-table-column>
            <el-table-column
              label="目标完成率"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.finishedRate}}
              </template>
            </el-table-column>
            <el-table-column
              label="基本比例"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.percentAge}}
              </template>
            </el-table-column>
            <el-table-column
              label="目标系数"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.targetRate}}
              </template>
            </el-table-column>
            <el-table-column
              label="绩效提成比例"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.finishedRatio}}
              </template>
            </el-table-column>
            <el-table-column
              label="提成比例"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.royaltyRatio}}
              </template>
            </el-table-column>
            <el-table-column
              label="创建时间"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.createTime}}
              </template>
            </el-table-column>
            <el-table-column
              label="更新时间"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.updateTime}}
              </template>
            </el-table-column>
            <el-table-column
              label="更新人"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                {{scope.row.updateName}}
              </template>
            </el-table-column>
            <el-table-column
              fixed="right"
              label="操作"
              min-width="100"
              align="center">
              <template slot-scope="scope">
                <el-button type="text" @click="showPop('edit',scope.row)">修改</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="pagination-container">
            <el-pagination
              background
              @size-change="handleSizeChange2"
              @current-change="handleCurrentChange2"
              layout="total, sizes,prev, pager, next,jumper"
              :current-page.sync="listQuery2.pageNum"
              :page-size="listQuery2.pageSize"
              :page-sizes="[10,15,20]"
              :total="count2">
            </el-pagination>
          </div>
      </el-tab-pane>
      <el-tab-pane label="部门" name="team" v-if="monthTargetSaleTeam"><!-- v-if="monthTargetSaleTeam"-->
        <div style="margin-top: 20px">
          <!--搜索-->
          <el-form :inline="true" :model="listQuery3" size="mini" label-width="80px">
            <el-form-item label="月份：">
              <el-date-picker
                value-format="yyyy-MM"
                v-model="listQuery3.date"
                type="monthrange"
                range-separator="-"
                start-placeholder="开始月份"
                end-placeholder="结束月份">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="业务员：">
              <el-select v-model="listQuery3.userIds" filterable placeholder="请选择" clearable multiple  style="width:440px;">
                <el-option
                  v-for="item in userOptionList2"
                  :key="item.userId"
                  :label="item.name"
                  :value="item.userId">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button
                @click="handleSearchList3()"
                type="primary">
                查询
              </el-button>
            </el-form-item>
          </el-form>
        </div>
        <!--数据列表-->
        <el-table
          height="400"
          v-loading="listLoading3"
          :data="tableData3"
          border
          style="width: 100%; margin-top: 20px">
          <el-table-column
            label="销售员"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.userName}}
            </template>
          </el-table-column>
          <el-table-column
            label="司龄"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.time}}
            </template>
          </el-table-column>
          <el-table-column
            label="月份"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.month}}
            </template>
          </el-table-column>
          <el-table-column
            label="基准目标"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.standard}}
            </template>
          </el-table-column>
          <el-table-column
            label="月目标量"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.targetVolume}}
            </template>
          </el-table-column>
          <el-table-column
            label="实际业务量"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.volume}}
            </template>
          </el-table-column>
          <el-table-column
            label="目标完成率"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.finishedRate}}
            </template>
          </el-table-column>
          <el-table-column
            label="基本比例"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.percentAge}}
            </template>
          </el-table-column>
          <el-table-column
            label="目标系数"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.targetRate}}
            </template>
          </el-table-column>
          <el-table-column
            label="绩效提成比例"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.finishedRatio}}
            </template>
          </el-table-column>
          <el-table-column
            label="提成比例"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.royaltyRatio}}
            </template>
          </el-table-column>
          <el-table-column
            label="创建时间"
            min-width="100"
            align="center">
            <template slot-scope="scope">
              {{scope.row.createTime}}
            </template>
          </el-table-column>


        </el-table>
        <div class="pagination-container">
          <el-pagination
            background
            @size-change="handleSizeChange3"
            @current-change="handleCurrentChange3"
            layout="total, sizes,prev, pager, next,jumper"
            :current-page.sync="listQuery3.pageNum"
            :page-size="listQuery3.pageSize"
            :page-sizes="[10,15,20]"
            :total="count3">
          </el-pagination>
        </div>
      </el-tab-pane>
    </el-tabs>


    <!--新增目标-->
    <el-dialog
      :close-on-click-modal="false"
      title="新增目标"
      :visible.sync="dialogVisible"
      width="350px">
      <el-form :model="form" size="mini" label-width="100px" ref="form" :rules="rules">
        <el-form-item label="姓名：" prop="userId">
          <el-select v-model="form.userId" filterable placeholder="请选择" clearable style="width:130px" @change="changeNum" :disabled="activeName != 'all'">
            <el-option
              v-for="item in userOptionList"
              :key="item.userId"
              :label="item.name"
              :value="item.userId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="月份：" prop="month">
          <el-date-picker
            value-format="yyyy-MM"
            @change="changeNum"
            style="width:130px;"
            v-model="form.month"
            type="month"
            placeholder="选择月">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="最低目标量：" >
            {{form.minNum}}
        </el-form-item>
        <el-form-item label="月目标量：" prop="targetVolume">
            <el-input-number v-model="form.targetVolume" :min="form.minNum"></el-input-number>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
          <el-button @click="handleClose">取 消</el-button>
          <el-button type="primary" @click="handleConfirm" :loading="btnLoading">确 定</el-button>
      </span>
    </el-dialog>

    <!--导入-->
    <el-dialog
      :show-close="showClose2"
      :close-on-click-modal="showClose2"
      :close-on-press-escape="showClose2"
      title="批量导入"
      :beforeClose="beforeCloseEditPrice2"
      :visible.sync="dialogVisibleImprot2"
      width="500px">
      <div>
        <el-alert
          title="请先下载模板，维护后，再上传更新后的模板文件"
          type="warning"
          :closable="false">
        </el-alert>
        <div style="text-align: center;padding:20px;padding-bottom:10px">
          <el-link :href="url" type="primary" :underline="false">下载模板</el-link>
        </div>
        <div class="upload-div" style="margin-top:20px">
          <input id="upload" type="file" @change="importfxx(this)" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
          <el-button type="primary" size="small" :loading="uploadLoading">选择上传文件</el-button>
        </div>
        <div style="margin:20px auto;margin-bottom:0;word-break:break-all;text-align: left;line-height:20px;background: #fef0f0;color:#f56c6c;padding:10px" v-if="msg2!=''">
          <div style="max-height: 90px;overflow: auto;padding:10px"><div v-if="showFial2">添加失败：</div>{{msg2}}</div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="handleEditPriceConfirm2" :loading="EditLoading2">提 交</el-button>
      </span>
    </el-dialog>

  </div>
</template>
<script>
import {getDepartmentUser,getTargetVolumeList,addTargetVolume,getUserMinimum,importVolume} from '@/api/partner'
import {goodsList} from '@/api/company'
import {formatDate} from '@/utils/date';
import store from '@/store'
import { mapGetters } from 'vuex'
import { getToken } from '@/utils/auth'
import XLSX from "xlsx";
const defaultListQuery={
   date:[],
  "pageNum" : 1,
  "pageSize" : 10
};

const defaultListQuery2={
  "userIds" : [],  //业务员ID
  date:[],
  "pageNum" : 1,
  "pageSize" : 10
};

const defaultForm={
  utvId:0,
  "month" :'',  //月份
  "userId"  : '', //员工
  "minNum" : 0, //最低量
  "targetVolume":'',//目标量
}






export default {
  name: "index",
  data(){
    return {
      listQuery: JSON.parse(JSON.stringify(defaultListQuery)),
      tableData: [],
      listLoading: false,
      roles:store.getters.roles ? store.getters.roles : [],
      loading:false,
      count:0,
      activeName:'my',


      listQuery2: JSON.parse(JSON.stringify(defaultListQuery2)),
      tableData2: [],
      listLoading2: false,
      count2:0,



      listQuery3: JSON.parse(JSON.stringify(defaultListQuery2)),
      tableData3: [],
      listLoading3: false,
      count3:0,


      dialogVisible:false,
      form:JSON.parse(JSON.stringify(defaultForm)),
      btnLoading:false,
      rules:{
        month:[{required: true, message: '此项必填', trigger: 'change'},],
        userId:[{required: true, message: '此项必填', trigger: 'change'},],
        targetVolume:[{required: true, message: '此项必填', trigger: 'blur'},],
      },

      userOptionList2:[],
      userOptionList:[],

      dialogVisibleImprot2:false,//批量导入弹窗
      EditLoading2:false,//批量导入提交按钮loadin
      showFial2:false,//批量导入失败
      msg2:'',//上传文件信息
      uploadLoading:false,
      da:[],
      file:null,
      showClose2:false,
      url:'',
      token:'',
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'mobile',
      'userId',
      'isMange',
    ]),
    monthTargetSaleAll(){
      if(this.roles.indexOf("monthTargetSaleAll") != -1){
        return true
      }else{
        return false
      }
    },
    monthTargetSaleTeam(){
      if(this.roles.indexOf("monthTargetSaleTeam") != -1){
        return true
      }else{
        return false
      }
    },

  },
  created() {
    this.getUserOptionList();
    this.getUserOptionList2();
    this.getList();
    this.token = getToken();
    this.url = '/api/user/volumeDownload?token=' + this.token;
  },

  methods:{
    //导入excel
    importfxx(obj) {
      let _this = this;
      this.uploadLoading = true;
      let inputDOM = this.$refs.inputer;
      // 通过DOM取文件数据
      this.file = event.currentTarget.files[0];
      var rABS = false; //是否将文件读取为二进制字符串
      var f = this.file;
      var reader = new FileReader();
      //if (!FileReader.prototype.readAsBinaryString) {
      FileReader.prototype.readAsBinaryString = function(f) {
        var binary = "";
        var rABS = false; //是否将文件读取为二进制字符串
        var pt = this;
        var wb; //读取完成的数据
        var outdata;
        var reader = new FileReader();
        reader.onload = function(e) {
          var bytes = new Uint8Array(reader.result);
          var length = bytes.byteLength;
          for(var i = 0; i < length; i++) {
            binary += String.fromCharCode(bytes[i]);
          }
          var XLSX = require('xlsx');
          if(rABS) {
            wb = XLSX.read(btoa(fixdata(binary)), { //手动转化
              type: 'base64'
            });
          } else {
            wb = XLSX.read(binary, {
              type: 'binary'
            });
          }
          outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);//outdata就是你想要的东西
          _this.da = [...outdata];
          console.log("da",_this.da)
          let arr = [];

          let para = {
            withList: arr
          };
          _this.$message({
            message: '上传成功，请点击提交',
            type: 'success'
          });
          _this.uploadLoading = false;
        };
        reader.readAsArrayBuffer(f);
      };
      if(rABS) {
        reader.readAsArrayBuffer(f);
      } else {
        reader.readAsBinaryString(f);
      }
    },
    //显示导入弹窗
    showImport2(){
      this.showFial2 = false;
      this.EditLoading2 = false;
      this.uploadLoading = false;
      this.msg2 = '';
      this.dialogVisibleImprot2 = true;
    },
    //关闭导入弹窗
    beforeCloseEditPrice2(){
      $("#upload").val('');
      this.da = [];
      this.msg2 = '';
      this.dialogVisibleImprot2 = false;
    },


    //提交导入
    handleEditPriceConfirm2(){
      if (this.da.length == 0){
        this.$message({
          message: '上传数据为空',
          type: 'warning'
        });
        return false;
      }
      this.msg2 = '后台处理中，请耐心等待……';
      this.showFial2 = false;
      this.EditLoading2 = true;
      this.showClose2 = false;
      importVolume({list:this.da}).then((res)=>{
        this.$message({
          message: '修改成功',
          type: 'success'
        });
        this.msg2 = '修改成功';
        this.EditLoading2 = false;
        this.dialogVisible2 = false;
        this.showClose2 = true;
        this.da = [];
        this.dialogVisibleImprot2 = false;
        $("#upload").val('');
        this.getList2();
      }).catch((err)=>{
        this.msg2 = err.msg;
        this.showFial2 = true;
        this.EditLoading2 = false;
        $("#upload").val('');
        this.showClose2 = true;
      })
    },
    //获取员工下拉选项
    getUserOptionList(){
      getDepartmentUser({type:'all'}).then((res)=>{
        this.userOptionList = res;
      })
    },

    //获取员工下拉选项部门
    getUserOptionList2(){
      getDepartmentUser({type:'department'}).then((res)=>{
        this.userOptionList2 = res;
      })
    },

    tabClick(e){
      console.log(this.activeName)
      switch (e.name){
        case 'my':
          this.getList();
          break;
        case 'all':
          this.getList2();
          break;
        case 'team':
          this.getList3();
          break;
      }
    },

    changeNum(){
       if(this.form.userId != '' && this.form.month != ''){
         getUserMinimum({userId:this.form.userId,month:this.form.month}).then((res)=>{
             this.form.minNum = res
         })
       }
    },

    showPop(type,item){
      this.dialogVisible = true;
      this.form = JSON.parse(JSON.stringify(defaultForm));
      if(this.activeName == 'my'){
        this.form.userId = this.userId
      }
      if(type == 'edit'){
        for(let k in defaultForm)
        {
          this.form[k] = item[k]
        }
      }
    },
    //关闭设置
    handleClose(){
      this.dialogVisible = false;
    },
    //确认设置
    handleConfirm(){
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.btnLoading = true;
          let data = JSON.parse(JSON.stringify(this.form));
          addTargetVolume(data).then((res)=>{
            this.btnLoading = false;
            this.handleClose();
            this.getList();
            this.getList2();
            this.getList3();
          }).catch(()=>{
            this.btnLoading = false;
          })
        }
      })
    },



    getList3(){
      let pa = JSON.parse(JSON.stringify(this.listQuery3))
      pa.tab = 'department'
      getTargetVolumeList(this.listQuery3).then((res)=>{
        this.tableData3 = res.list;
        this.count3 = res.count
      })
    },
    handleSizeChange3(val){
      this.listQuery3.pageNum = 1;
      this.listQuery3.pageSize = val;
      this.getList3();
    },
    handleCurrentChange3(val){
      this.listQuery3.pageNum = val;
      this.getList3();
    },

    handleSearchList3(){
      this.listQuery3.pageNum = 1;
      this.getList3();
    },





    handleSizeChange(val){
      this.listQuery.pageNum = 1;
      this.listQuery.pageSize = val;
      this.getList();
    },
    handleCurrentChange(val){
      this.listQuery.pageNum = val;
      this.getList();
    },

    //获取列表
    getList() {
      this.listLoading = true;
      let pa = JSON.parse(JSON.stringify(this.listQuery))
      pa.tab = 'myCharge'
      getTargetVolumeList(pa).then(response => {
        this.tableData = response.list;
        this.count = response.count;
        this.listLoading = false;
      }).catch(()=>{
        this.listLoading = false;
      });
    },

    handleSearchList(){
      this.listQuery.pageNum = 1;
      this.getList();
    },


    handleSizeChange2(val){
      this.listQuery2.pageNum = 1;
      this.listQuery2.pageSize = val;
      this.getList2();
    },
    handleCurrentChange2(val){
      this.listQuery2.pageNum = val;
      this.getList2();
    },

    handleSearchList2(){
      this.listQuery2.pageNum = 1;
      this.getList2();
    },

    //获取列表
    getList2() {
      this.listLoading2 = true;
      let pa = JSON.parse(JSON.stringify(this.listQuery2))
      pa.tab = 'all'
      getTargetVolumeList(pa).then(response => {
        this.tableData2= response.list;
        this.count2 = response.count;
        this.listLoading2 = false;
      }).catch(()=>{
        this.listLoading2 = false;
      });
    },


  },
}
</script>

<style scoped lang="scss">
.avatar-uploader{
  margin-bottom:10px;
  display: block;
}
.upload-div{
  text-align: center;
  position:relative;
  #upload{

    opacity: 0;
    position: absolute;
    z-index: 1;
    width:154px;
    height:40px
  }
}
</style>

